home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
parstp25.zip
/
CALCW.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-02-14
|
1KB
|
48 lines
(******************************************************************************
* calc *
* HyperAct Inc. CALC - Parser demo program. *
* (c) 1992, 1994 HyperAct Inc, Written By Ron Loewy. *
* Version 2.5, Feb. 1994. *
******************************************************************************)
program calcW;
{$N+}
uses
parslib
,strings
{$ifdef windows}
,wincrt
{$endif}
;
var
exitFlag,
validity : boolean;
s : array[0 .. 255] of char;
result : double;
begin
writeln('CALC V2.5, HyperAct Inc, Parser demo program');
writeln;
writeln('Enter mathematical expression, or QUIT/EXIT to DOS');
writeln;
exitFlag := false;
repeat
write('CALC> ');
readln(s);
strUpper(s);
if ((strLComp(s, 'QUIT', 4) = 0) or (strLComp(s, 'EXIT', 4) = 0)) then
exitFlag := true
else begin
result := getExpr(s, validity);
if (not validity) then
writeln('Error in expression, at position ', trunc(result))
else
writeln('RSLT> ', result);
end; { not a QUIT command }
until (exitFlag);
writeln;
writeln('Thank you for using CALC, HyperAct Inc.');
writeln;
{ closeWindow; }
end.